var t = require("../../@babel/runtime/helpers/interopRequireDefault")(require("../../@babel/runtime/helpers/defineProperty")), e = require("../../services/api.js"), a = require("../../utils/util.js");

Page({
    data: {
        tabs: [ "全部", "进行中", "已完成" ],
        active: 0,
        page: [ 1, 1, 1 ],
        counts: [ 0, 0, 0 ],
        lists: Array(3).fill([])
    },
    onLoad: function(t) {},
    uppz: function(t) {
        var e = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/pages/form/index?id=".concat(e)
        });
    },
    giveUpTask: function(t) {
        var a = this;
        wx.showModal({
            title: "提示",
            content: "确定放弃任务吗？",
            confirmText: "放弃",
            cancelText: "再考虑",
            success: function(s) {
                s.confirm && (0, e.taskQuit)({
                    t_m_id: t.currentTarget.dataset.id
                }).then(function(t) {
                    200 === t.data.code ? wx.showToast({
                        title: "操作成功",
                        mask: !0
                    }) : wx.showModal({
                        title: "提示",
                        content: t.data.message,
                        showCancel: !1
                    }), a.getLists();
                });
            }
        });
    },
    tabChangeHandle: function(t) {
        var e = this;
        this.setData({
            active: t.detail.current
        }, function() {
            e.getLists();
        });
    },
    route: function(t) {
        var e = t.currentTarget.dataset, a = e.id, s = e.stage;
        a && ("等待初审" != s && "等待复审" != s || wx.navigateTo({
            url: "/pages/detail/index?id=".concat(a)
        }));
    },
    onReady: function() {},
    getLists: function() {
        var s = this, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1, i = this.data.active, o = {
            page: n,
            pageSize: 8,
            status: i - 1
        };
        o.status < 0 && delete o.status, (0, e.getTaskOrderLists)(o).then(function(e) {
            if (200 === e.data.code) {
                var o, u = e.data.data.list.map(function(t) {
                    return t.diff = (0, a.timeDiff)(t.createTime, "等待初审" === t.stage ? 1 : 2), t._status = (0, 
                    a.getOrderStatus)({
                        stage: t
                    }), t._stage = 0 === t._status || 2 === t._status ? "待上传" : 1 === t._status || 3 === t._status ? "待审核" : t.stage, 
                    t.btn = 0 === t._status ? "上传初审凭证" : "上传复审凭证", t;
                });
                s.setData((o = {}, (0, t.default)(o, "lists[".concat(i, "]"), n > 1 ? [].concat(s.data.lists[i], u) : u), 
                (0, t.default)(o, "counts[".concat(i, "]"), e.data.data.count), (0, t.default)(o, "page[".concat(i, "]"), n), 
                o));
            }
        });
    },
    getStatusText: function(t, e) {},
    onShow: function() {
        this.getLists();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        wx.stopPullDownRefresh(), this.onShow();
    },
    onReachBottom: function() {
        var t = this.selectComponent("#pagination");
        if (!t) return !1;
        var e = t.hasMore();
        e && this.getLists(e);
    },
    onShareAppMessage: function() {}
});